﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class index : StudentPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        agreebtn.Text = Resources.labels.read_exregulation;
        if (!IsPostBack)
        {
            Label1.Text = isTheMe.StudentNumber.Trim();
            Label2.Text = Server.UrlDecode(isTheMe.StudentName.Trim());
            Label3.Text = isTheMe.StudentPassword.Trim();
            Label4.Text = isTheMe.StudentEmail.Trim();
            Label5.Text = Server.UrlDecode(isTheMe.StudentName.Trim());

            string ExRegulation = Tools.ReadText(Server.MapPath("~/App_Data/ExRegulation.txt"));
            TextBox1.Text = Server.HtmlDecode(ExRegulation);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //获取我所有的试卷
        string SQL = "SELECT PaperID FROM StudentPaper WHERE StudentID=" + isTheMe.StudentID.Trim();

        //获取我所属部门的 当前考试试卷
        SQL = "SELECT PaperID FROM Paper WHERE DepartmentID=" + isTheMe.DepartmentID.Trim() + " AND IsCurrExam=1";
        object obj = Exam.Core.DAL.DataProvider.GetSingle(SQL);
        if (null != obj) {//当前存在考试
            int id = int.Parse(obj.ToString().Trim());
            if (id > 0) {
                string link = string.Empty;
                if (ExamSys.ExamType.Trim() == "1") {
                    link = "exambystep.aspx?id=" + id;//进入考卷，开始考试
                }
                else if (ExamSys.ExamType.Trim() == "2") {
                    link = "Exam.aspx?id=" + id;//进入考卷，开始考试
                }
                Response.Redirect(link, true);
            }
            else {
                //当前没有考试
                RedirectNoExam();
            }

        }
        else {//当前没有考试
            RedirectNoExam();
        }
    }

    private void RedirectNoExam() {
        throw new NotImplementedException();
    }
}